package db.mysql;

import java.sql.*;

import exceptions.DatabaseException;

public class DB_Connection {

	
	private static DB_Connection conn = null;
	static {
		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
		} catch(Exception ex) {
			
		}
		
	}
	
	private DB_Connection() {
		
	}
	
	
	public static DB_Connection getInstance() {
		if(conn == null) {
			DB_Connection.conn = new DB_Connection();
		}
		
		return DB_Connection.conn;
	}
	
	public Connection getDBConnection() throws DatabaseException {
		Connection conn;
		try {
			conn = DriverManager.getConnection("jdbc:mysql://localhost/epad","root","");
		} catch (SQLException e) {
			throw new DatabaseException("Databaseconnection could not be established");
		}
		return conn;
	}
}